<HTML xmlns:z>
  
 
 <HEAD>
  <TITLE> 日志配置</TITLE>
  <META HTTP-EQUIV="pragma" CONTENT="no-cache">
  <META HTTP-EQUIV="Cache-Control" CONTENT="no-cache, must-revalidate">
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <script type="text/javascript" 	src="../../js/jquery.pack.js"></script>
	<script type="text/javascript"  src="../../js/riaframework.js"></script>
	<script type="text/javascript"  src="../../js/ssb.js"></script>
    <link href="../../css/cssCn.css" rel="stylesheet" type="text/css">
</HEAD>
 <script type="text/javascript">
function ShowTable(imgCtrl)
{
	var ImgPlusScr ="../../images/icon_expandall.gif";      
	var ImgMinusScr ="../../images/icon_collapseall.gif";	
 	var TableID = imgCtrl.id.replace("1","2");
 	var tableCtrl = document.getElementById(TableID);
 				 
 	if(imgCtrl.src.indexOf("icon_expandall") != -1)
 	{
 		tableCtrl.style.display ="";
 		imgCtrl.src = ImgMinusScr ;
 	}
    else
 	{	
 		tableCtrl.style.display ="none";
 		imgCtrl.src = ImgPlusScr ;		 
 	}
}
///////////////////////查询方法////////////////////////////
 var loglist = {};
 function initloginfo()
 {
  	callUrl('logConfigFacade/getModelList.ssm', null ,'loglist','true');  	
  	var arr = loglist.rtnValue;
  	for(var i = 0; i < arr.length; i++)
  	{
  		var name = arr[i].levename.toUpperCase();
  		var table = null;
  	    switch(name)
  	    {
  	      case "DEBUG":
	  	      table = document.getElementById(name+"2"); 	
  	          break;
  	      case "INFO":
  	          table = document.getElementById(name+"2"); 	
  	          break;
  	      case "ERROR":
  	          table = document.getElementById(name+"2"); 	
  	          break;
  	      case "WARN":
  	          table = document.getElementById(name+"2"); 	
  	          break;
  	      default:
  	         break;
  	    }
  	    if(table != null )
  	    {
          var input_arr = table.getElementsByTagName("input");
          var fs = arr[i].fileSize.split("KB");
                    
          if(arr[i].file != null)
          {
	  	      input_arr[0].value=arr[i].file;
	  	      input_arr[1].value=fs[0];
	  	      //input_arr[2].value=arr[i].backupIndex;
	  	      var oseclect = table.getElementsByTagName("select")[0];

	  	      oseclect.options[arr[i].backupIndex].selected = true;
  	      }
  	    } 
  	}
 }
 /////////////////////////////////////////////////////////////
 //////////////////////////保存方法///////////////////////////
 var flag = {};

 function save()
 {
 	var list = new Array(4);
    var patrn=/^[1-9][0-9]*$/;
 	for(var i = 0; i < list.length; i++)
  	{
  	    var obj = {};
  		var table = null;
  	    switch(i)
  	    {
  	      case 0:
  	          obj.levename = "DEBUG";
	  	      table = document.getElementById("DEBUG2"); 	
  	          break;
  	      case 1:
  	          obj.levename = "INFO";
  	          table = document.getElementById("INFO2"); 	
  	          break;
  	      case 2:
  	          obj.levename = "ERROR";
  	          table = document.getElementById("ERROR2"); 	
  	          break;
  	      case 3:
  	          obj.levename = "WARN";
  	          table = document.getElementById("WARN2"); 	
  	          break;
  	      default:
  	         break;
  	    }
  	    if(table != null )
  	    {
          var input_arr = table.getElementsByTagName("input");
          var select_arr = table.getElementsByTagName("select");
          
          var mfile = trim(input_arr[0].value);
          var mfileSize = trim(input_arr[1].value);
          var mbackupIndex = select_arr[0].value;
          if(mfile != '' || mfileSize != '')
          {
          	if(mfile == '')
          	{
          	   alert("日志文件名不能为空!");
          	   input_arr[0].focus();
          	   return false;
          	}
          	else if(checkfileurl(input_arr[0].value))
          	{
          	   alert("日志文件名只能输入字母、数字、“_ . / - = ~ % ”的字串!");
          	   input_arr[0].focus();
          	   return false;
          	}
          	if(mfileSize == '')
          	{
          	   alert("日志文件大小不能为空!");
          	   input_arr[1].focus();
          	   return false;
          	}
          	else if(!patrn.test(input_arr[1].value))
          	{
          	   alert("日志文件大小必须为大于0的整数!");
          	   input_arr[1].focus();
          	   return false;
          	}         
          }
          else if(mfile == '' && mfileSize == '')
          {
             mfileSize = 0;
          }
  	      obj.file = mfile;
  	      obj.fileSize = mfileSize+"KB";
  	      obj.backupIndex = mbackupIndex;
  	    } 
  	    list[i] = obj;
  	}
  	
  	///alert(list.toJSONString());
  	callUrl('logConfigFacade/updateConfigFile.ssm', list ,'flag','true');  	
  	if(flag.rtnValue == true)
  	{
  	   alert("修改成功!");
  	}
 }
 
 addOnloadEvent(initloginfo);
  </script>
<BODY>
	
<z:binds>
    <z:bind ctrl="getAccountname"  ref="obj1.name" />
	<z:bind ctrl="getAccountId"  ref="obj1.employeeId" />
	<z:bind ctrl="zteTable"  ref="listArr" />	
</z:binds>
<z:service id='getLogInfo' method='post' url='logConfigFacade/getModelList.ssm'>
	<z:request onRequest=''  offRequest=''/>
	<z:response rtn='$M.listArr'  onResponse='' offResponse='' onerror=''/>
</z:service>
<DIV id=overDiv style="POSITION: absolute; Z-INDEX: 1"></DIV>
 <table width="100%" border="0">
   <tr>
     <td><div align="left" class="div_subtitle">当前位置：系统管理<span class="arrow_subtitle">&gt;</span>应用配置<span class="arrow_subtitle">&gt;</span>日志配置</div></td>
   </tr>
 </table>
 <TABLE align=center width="100%" border="0"  cellPadding=0 cellSpacing=0 id=tb_content>
  <TBODY>
    <TR>
      <TD vAlign=top>
      
           <table width="100%" border="0" class="tb_titlebar">
             <tr>
               <td><a href="#"><img src="../../images/icon_collapseall.gif" name="Img1" width="16" height="16" border="0" 
class="icon" id="DEBUG1"  onclick="ShowTable(this);"></a>Debug 级别配置</td>
             </tr>
           </table>
           <TABLE class=tb_input cellSpacing=1 width="100%" id="DEBUG2" style="display:">
              <TBODY>                
                <TR>
                  <TD width="13%" noWrap class="td_title">日志文件名(含路径)</TD>
                  <TD colspan="3"><INPUT name="Input4" id=beginTime style="WIDTH: 300px" ></TD>
                </TR>
                <TR>
                  <TD width="13%" class="td_title">文件大小(KB)</TD>
                  <TD width="40%"><INPUT name=beginTime1 style="WIDTH: 100px" size="20"></TD>
                  <TD width="13%" noWrap class="td_title">备份文件数</TD>
                  <TD>
                  <select name="backupIndex" style="width:80px" id="debug">
				    <option value="0">0</option>
                    <option value="1">1</option>
                    <option value="2">2</option>
                    <option value="3">3</option>
                    <option value="4">4</option>
                    <option value="5">5</option>
                    <option value="6">6</option>
                    <option value="7">7</option>
                    <option value="8">8</option>
                    <option value="9">9</option>
                    <option value="10">10</option>
                  </select>                  
                  </TD>
                </TR>
              </TBODY>
          </TABLE>
           <table width="100%" border="0" class="tb_titlebar">
             <tr>
               <td><a href="#"><img src="../../images/icon_collapseall.gif" name="Info1" width="16" height="16" border="0" 
class="icon" id="INFO1"  onclick="ShowTable(this);"></a>Info 级别配置</td>
             </tr>
           </table>
           <TABLE class=tb_input cellSpacing=1 
            width="100%" id="INFO2" style="display:" >
             <TR>
               <TD width="13%" noWrap class="td_title">日志文件名(含路径)</TD>
               <TD colspan="3"><INPUT name="Input4" id=beginTime style="WIDTH: 300px" ></TD>
             </TR>
             <TBODY>
               
               <TR>
                 <TD width="13%" class="td_title">文件大小(KB)</TD>
                 <TD width="40%"><INPUT name=beginTime1 style="WIDTH: 100px" size="20"></TD>
                 <TD width="13%" noWrap class="td_title">备份文件数</TD>
                 <TD>
                 <select name="backupIndex" style="width:80px" id="info">
				    <option value="0">0</option>
                    <option value="1">1</option>
                    <option value="2">2</option>
                    <option value="3">3</option>
                    <option value="4">4</option>
                    <option value="5">5</option>
                    <option value="6">6</option>
                    <option value="7">7</option>
                    <option value="8">8</option>
                    <option value="9">9</option>
                    <option value="10">10</option>
                  </select>
                 </TD>
               </TR>
             </TBODY>
           </table>
           <table width="100%" border="0" class="tb_titlebar">
             <tr>
               <td><a href="#"><img src="../../images/icon_collapseall.gif" name="Img3" width="16" height="16" border="0" 
class="icon" id="WARN1"  onclick="ShowTable(this);"></a>Warn 级别配置</td>
             </tr>
           </table>
           <TABLE class=tb_input cellSpacing=1 
            width="100%" id="WARN2" style="display:" >
             <TR>
               <TD width="13%" noWrap class="td_title">日志文件名(含路径)</TD>
               <TD colspan="3"><INPUT name="Input4" id=beginTime style="WIDTH: 300px"></TD>
             </TR>
             <TBODY>
               
               <TR>
                 <TD width="13%" class="td_title">文件大小(KB)</TD>
                 <TD width="40%"><INPUT name=beginTime1 style="WIDTH: 100px" size="20"></TD>
                 <TD width="13%" noWrap class="td_title">备份文件数</TD>
                 <TD >
                 <select name="backupIndex" style="width:80px" id="warn">
				    <option value="0">0</option>
                    <option value="1">1</option>
                    <option value="2">2</option>
                    <option value="3">3</option>
                    <option value="4">4</option>
                    <option value="5">5</option>
                    <option value="6">6</option>
                    <option value="7">7</option>
                    <option value="8">8</option>
                    <option value="9">9</option>
                    <option value="10">10</option>
                  </select>
                 </TD>
               </TR>
             </TBODY>
           </table>
           <table width="100%" border="0" class="tb_titlebar">
             <tr>
               <td><a href="#"><img src="../../images/icon_collapseall.gif" name="Img4" width="16" height="16" border="0" 
class="icon" id="ERROR1"  onclick="ShowTable(this);"></a>Error 级别配置</td>
             </tr>
           </table>
           <TABLE class=tb_input cellSpacing=1 
            width="100%" id="ERROR2" style="display:" >
             <TBODY>
               <TR>
                 <TD width="13%" noWrap class="td_title">日志文件名(含路径)</TD>
                 <TD colspan="3"><INPUT name="Input4" id=beginTime style="WIDTH: 300px" ></TD>
               </TR>
               <TR>
                 <TD width="13%" class="td_title">文件大小(KB)</TD>
                 <TD width="40%"><INPUT name=beginTime1 style="WIDTH: 100px" size="20"></TD>
                 <TD width="13%" noWrap class="td_title"> 备份文件数 </TD>
                 <TD >
                 <select name="backupIndex" style="width:80px" id="error">
				    <option value="0">0</option>
                    <option value="1">1</option>
                    <option value="2">2</option>
                    <option value="3">3</option>
                    <option value="4">4</option>
                    <option value="5">5</option>
                    <option value="6">6</option>
                    <option value="7">7</option>
                    <option value="8">8</option>
                    <option value="9">9</option>
                    <option value="10">10</option>
                  </select>
                 </TD>
               </TR>
             </TBODY>
           </table>
           <div align="right" class="div_no">
             <input name="Submit" type="button" class="button" onclick="save()" value="保存">

           </div>
         
</TD>
    </TR>
  </TBODY>
</TABLE>
		

</BODY>


</HTML>
